# Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
# This source file is part of the Cangjie project, licensed under Apache-2.0
# with Runtime Library Exception.
#
# See https://cangjie-lang.cn/pages/LICENSE for license information.

template = '''
/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
 * This source file is part of the Cangjie project, licensed under Apache-2.0
 * with Runtime Library Exception.
 *
 * See https://cangjie-lang.cn/pages/LICENSE for license information.
 */

/*
  @Assertion:   4.16(4) The syntax of relational expressions are defined as:
                equalityComparisonExpression
                    : comparisonExpression (equalityOperator comparisonExpression)?
                    ;
                comparisonOrTypeExpression
                    : shiftingExpression (comparisonOperator shiftingExpression)?
                    | ...
                    ;
                equalityOperator
                    : '!=' | '=='
                    ;
                comparisonOperator
                : '<' | '>' | '<=' | '>='
                ;
  @Description: Checks that postfix {p} is not permitted.
  @Mode: compileonly
  @Negative: yes
  @Structure: single
  @CompileWarning: no
  @Comment: Auto-generated by gen_postfix.py
*/

main() {{
    1 + 2 - 3 * 4 % 5 {p}
}}
'''

def gen(path : str, counter : int):
  for p in ['==', '!=', '>', '<', '>=', '<=']:
    counter += 1
    with open(path.format(str(counter).zfill(2)), 'w') as file:
      file.write(template.format(p=p))
  return counter
